get id in jquery

47

jquery get id value -

var myId = $(this).attr('id');
alert( myId );

jquery get id -

var myId = $("#test").prop("id");

how can ic get the id of div jq -

$(document).ready(function() {
  console.log($('#test').attr('id'));
});

Comments

Submit
0 Comments